#pragma once
#include "connItem.hpp"

// 处理 http请求报文，暂时不做任何请求
void HttpRequest(connItem *conn)
{
}

void HttpResponse(connItem *conn)
{
    std::string body = "<h1>hello world</h1>";

    conn->_outbuffer =
        "HTTP/1.1 200 OK\r\n"
        "Content-Type: text/html; charset=utf-8\r\n"
        "Content-Length: " +
        std::to_string(body.size()) + "\r\n"
                                      "Server: Apache/2.4.41\r\n"
                                      "Date: Mon, 18 Dec 2023 08:32:10 GMT\r\n"
                                      "X-Frame-Options: DENY\r\n"
                                      "X-Content-Type-Options: nosniff\r\n"
                                      "Referrer-Policy: strict-origin-when-cross-origin\r\n"
                                       "\r\n" // 空行分隔头部和正文
        + body;

    conn->_sender(conn);

    // 使用sendfile发送数据
}